package org.example.testcode.jvm;

import javax.xml.crypto.Data;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Debug JVM Paras
 * <p>
 * vm options:-Xms500M -Xmx500M -Xmn20M -XX:-UseAdaptiveSizePolicy
 *
 * -XX:-UseAdaptiveSizePolicy  配置交换区固定值
 */
public class DebugJVM_Main {


    private static List<char[]> bigCharObj = new ArrayList<>();

    public static int[] generate1M() {
        return new int[1024 * 256];
    }

    public static char[] generate1MChar() {
        return new char[1024 * 256];
    }

    public static void main(String[] args) throws InterruptedException {
        System.out.println("start=[" + new Date().toString() + "]");

        Thread.currentThread().sleep(1000 * 10);
        System.out.println("start=[" + new Date().toString() + "]");
        int i = 0;
        while (i < 10000) {
            System.out.println("start=[" + new Date().toString() + "]" + i);

            generate1M();
            i++;
            Thread.currentThread().sleep(50);
        }

    }

}
